package org.social.constant;

/**
 * 微信积分商城常量
 * 
 * @author liu.jiang
 * @date 2018年3月19日
 */
public enum WechatShopResult {
    SUCCESS(0, "success"), 
    ERR_PARAMS_PARSE(1, "params parse error"), 
    ERR_TOKEN(2, "token error"),
    ERR_SERVER_ID(3, "server id error"), 
    ERR_SERVER_CONNECT(4, "server connect error"), 
    ERR_ORDER_REPEATED(5, "order is repeated"), 
    ERR_ROLE_ID(6, "role id error"), 
    ERR_GAME_HANDLE(7, "game server handle error"), 
    ;

    private int code;
    private String msg;

    WechatShopResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static WechatShopResult valueOf(int code) {
        for (WechatShopResult it : WechatShopResult.values()) {
            if (it.getCode() == code) {
                return it;
            }
        }
        return null;
    }
}
